package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	// resp, err := http.Get("http://www.baidu.com/")

	url := "http://127.0.0.1:8000/go"
	client := &http.Client{}
	req, _ := http.NewRequest("GET", url, nil)
	req.Header.Set("nameAAA", "valueAAA")
	req.Header["eeeAAA"] = []string{"eeeAAA"}

	fmt.Println(req.Header)
	fmt.Println(req.Header.Get("nameAAA"))
	fmt.Println(req.Header.Get("Nameaaa"))
	fmt.Println(req.Header["eeeAAA"])
	fmt.Println(req.Header["Eeeaaa"])

	res, _ := client.Do(req)

	// resp, err := http.Get()
	// if err != nil {
	// fmt.Println("get failed, err:", err)
	// return
	// }
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println("read from resp.Body failed,err:", err)
		return
	}
	fmt.Print(string(body))
}
